---
sidebar_label: Supported Postgres types
sidebar_position: 14
description: Supported Postgres types in the Hasura API
keywords:
  - hasura
  - docs
  - postgres types
---

# Postgres: Supported Types

## Introduction {#types-table}

List of PostgreSQL types supported by the Hasura GraphQL Engine with their equivalent Hasura types:

| Name                                    | Aliases            | Description                                                 | Hasura Type                                                                                                                   |
| --------------------------------------- | ------------------ | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| bigint                                  | int8               | signed eight-byte integer                                   | [Numeric](#numeric) or [String](#string) ([flag](/deployment/graphql-engine-flags/reference.mdx#stringify-numeric-types))     |
| bigserial                               | serial8            | autoincrementing eight-byte integer                         | [Numeric](#numeric) or [String](#string) ([flag](/deployment/graphql-engine-flags/reference.mdx#stringify-numeric-types))     |
| bit [ (n) ]                             |                    | fixed-length bit string                                     | [Implicit](#implicit)                                                                                                         |
| bit varying [ (n) ]                     | varbit [ (n) ]     | variable-length bit string                                  | [Implicit](#implicit)                                                                                                         |
| boolean                                 | bool               | logical Boolean (true/false)                                | [Bool](#bool)                                                                                                                 |
| box                                     |                    | rectangular box on a plane                                  | [Implicit](#implicit)                                                                                                         |
| bytea                                   |                    | binary data (“byte array”)                                  | [Implicit](#implicit)                                                                                                         |
| character [ (n) ]                       | char [ (n) ]       | fixed-length character string                               | [Char](#char)                                                                                                                 |
| character varying [ (n) ]               | varchar [ (n) ]    | variable-length character string                            | [String](#string)                                                                                                             |
| cidr                                    |                    | IPv4 or IPv6 network address                                | [Implicit](#implicit)                                                                                                         |
| circle                                  |                    | circle on a plane                                           | [Implicit](#implicit)                                                                                                         |
| date                                    |                    | calendar date (year, month, day)                            | [Date](#date)                                                                                                                 |
| double precision                        | float8             | double precision floating-point number (8 bytes)            | [Float](#float) or [String](#string) ([flag](/deployment/graphql-engine-flags/reference.mdx#stringify-numeric-types))         |
| inet                                    |                    | IPv4 or IPv6 host address                                   | [Implicit](#implicit)                                                                                                         |
| integer                                 | int, int4          | signed four-byte integer                                    | [Int](#int)                                                                                                                   |
| interval [ fields ] [ (p) ]             |                    | time span                                                   | [Implicit](#implicit)                                                                                                         |
| json                                    |                    | textual JSON data                                           | [JSON](#json)                                                                                                                 |
| jsonb                                   |                    | binary JSON data, decomposed                                | [JSONB](#jsonb)                                                                                                               |
| line                                    |                    | infinite line on a plane                                    | [Implicit](#implicit)                                                                                                         |
| lseg                                    |                    | line segment on a plane                                     | [Implicit](#implicit)                                                                                                         |
| ltree                                   |                    | labels of data stored in a hierarchical tree-like structure | [Implicit](#implicit)                                                                                                         |
| geometry                                |                    | PostGIS Geometry type                                       | [Geometry](#geometry)                                                                                                         |
| geography                               |                    | PostGIS Geography type                                      | [Geography](#geography)                                                                                                       |
| macaddr                                 |                    | MAC (Media Access Control) address                          | [Implicit](#implicit)                                                                                                         |
| macaddr8                                |                    | MAC (Media Access Control) address (EUI-64 format)          | [Implicit](#implicit)                                                                                                         |
| money                                   |                    | currency amount                                             | [Implicit](#implicit)                                                                                                         |
| numeric [ (p, s) ]                      | decimal [ (p, s) ] | exact numeric of selectable precision                       | [Numeric](#numeric) or [String](#string) ([flag](/deployment/graphql-engine-flags/reference.mdx#stringify-numeric-types))     |
| path                                    |                    | geometric path on a plane                                   | [Implicit](#implicit)                                                                                                         |
| pg_lsn                                  |                    | PostgreSQL Log Sequence Number                              | [Implicit](#implicit)                                                                                                         |
| point                                   |                    | geometric point on a plane                                  | [Implicit](#implicit)                                                                                                         |
| polygon                                 |                    | closed geometric path on a plane                            | [Implicit](#implicit)                                                                                                         |
| real                                    | float4             | single precision floating-point number (4 bytes)            | [Float](#float)                                                                                                               |
| smallint                                | int2               | signed two-byte integer                                     | [Int](#int)                                                                                                                   |
| smallserial                             | serial2            | autoincrementing two-byte integer                           | [Int](#int)                                                                                                                   |
| serial                                  | serial4            | autoincrementing four-byte integer                          | [Int](#int)                                                                                                                   |
| text                                    |                    | variable-length character string                            | [String](#string)                                                                                                             |
| time [ (p) ] [ without time zone ]      |                    | time of day (no time zone)                                  | [Implicit](#implicit)                                                                                                         |
| time [ (p) ] with time zone             | timetz             | time of day, including time zone                            | [Timetz](#timetz)                                                                                                             |
| timestamp [ (p) ] [ without time zone ] |                    | date and time (no time zone)                                | [Implicit](#implicit)                                                                                                         |
| timestamp [ (p) ] with time zone        | timestamptz        | date and time, including time zone                          | [Timestamptz](#timestamptz)                                                                                                   |
| tsquery                                 |                    | text search query                                           | [Implicit](#implicit)                                                                                                         |
| tsvector                                |                    | text search document                                        | [Implicit](#implicit)                                                                                                         |
| txid_snapshot                           |                    | user-level transaction ID snapshot                          | [Implicit](#implicit)                                                                                                         |
| uuid                                    |                    | universally unique identifier                               | [Implicit](#implicit)                                                                                                         |
| xml                                     |                    | XML data                                                    | [Implicit](#implicit)                                                                                                         |

## Int {#int}

GraphQL default scalar with name **Int**.

E.g.

```graphql
objects: [
  {
    int_col: 27
  }
]
```

## Float {#float}

GraphQL custom scalar type with name **float8**.

E.g.

```graphql
objects: [
  {
    float_col: 0.8
  }
]
```

:::info Note

To avoid loss of data when retrieving IEEE 754 style data from the database, please refer to the
[GraphQL Engine server config reference](/deployment/graphql-engine-flags/reference.mdx) for instructions on setting the
`extra_float_digits` parameter, which has a bad default value in PostgreSQL 11 and older.

:::

## Numeric {#numeric}

GraphQL custom scalar type with name **numeric**.

E.g.

```graphql
objects: [
  {
    numeric_col: 0.00000008
  }
]
```

:::info Note

When using a [numeric](/schema/postgres/postgresql-types.mdx#numeric) value in an [Action](/actions/overview.mdx), the
value is [coerced](https://spec.graphql.org/October2021/#sec-Scalars.Input-Coercion) to its expected scalar type based
on type of the input value supplied (from the Action payload). As stated in the spec, a GraphQL service (such as Hasura)
will attempt to coerce numeric values to `Int`, `Float`, or `String` types, so long as its reasonable and doesn't result
in the loss of data. Otherwise, the service will throw an error.

:::

## Bool {#bool}

GraphQL default Scalar with name **Boolean**. The **Boolean** scalar type represents `true` or `false`.

E.g.

```graphql
objects: [
  {
    is_published: true
  }
]
```

## Char {#char}

GraphQL custom scalar with name **character**. It is a `String` with single character.

E.g.

```graphql
objects: [
  {
    char_column: "a"
  }
]
```

## String {#string}

GraphQL default scalar with name **String**. The **String** scalar type represents textual data, represented as UTF-8
character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

E.g.

```graphql
objects: [
  {
    name: "Raven"
  }
]
```

## Date {#date}

GraphQL custom scalar with name **date**. Date (no time of day). Allowed values are yyyy-mm-dd.

E.g.

```graphql
objects: [
  {
    date: "1996-03-15"
  }
]
```

## Time with time zone {#timetz}

GraphQL custom scalar type with name **timetz**. Time of day only, with time zone. Allowed values should be of ISO8601
format (e.g. 17:30:15Z, 17:30:15+05:30, 17:30:15.234890+05:30).

E.g.

```graphql
objects: [
  {
    time: "17:30:15+05:30"
  }
]
```

## Timestamp with time zone {#timestamptz}

GraphQL custom scalar type with name **timestamptz**. Both date and time, with time zone. Allowed values should be of
ISO8601 format (e.g. 2016-07-20T17:30:15Z, 2016-07-20T17:30:15+05:30, 2016-07-20T17:30:15.234890+05:30).

E.g.

```graphql
objects: [
  {
    timestamptz_col: "2016-07-20T17:30:15+05:30"
  }
]
```

## JSON {#json}

GraphQL custom scalar type with name **json**. It is a stringified json value.

E.g.

```graphql
objects: [
  {
    json_col: "{ \"name\": \"raven\" }"
  }
]
```

## JSONB {#jsonb}

GraphQL custom scalar type with name **jsonb**. Value should be given through a variable of type **jsonb**.

E.g.

```graphql
mutation insert_test($value: jsonb) {
  insert_test(objects: [{ jsonb_col: $value }]) {
    affected_rows
    returning {
      jsonb_col
    }
  }
}
```

variables:

```json
{
  "value": {
    "name": "raven"
  }
}
```

## Geometry {#geometry}

GraphQL custom scalar type `geometry` is generated for a `GEOMETRY` column on a PostGIS enabled Postgres instance. Value
should be given as GeoJSON.

E.g.

```graphql
mutation insertGeometry($point: geometry!) {
  insert_test(objects: [{ geometry_col: $point }]) {
    affected_rows
    returning {
      geometry_col
    }
  }
}
```

variables:

```json
{
  "point": {
    "type": "Point",
    "coordinates": [0, 0]
  }
}
```

## Geography {#geography}

GraphQL custom scalar type `geography` is generated for a `GEOGRAPHY` column on a PostGIS enabled Postgres instance.
Value should be given as GeoJSON.

E.g.

```graphql
mutation insertGeography($point: geography!) {
  insert_test(objects: [{ geography_col: $point }]) {
    affected_rows
    returning {
      geography_col
    }
  }
}
```

variables:

```json
{
  "point": {
    "type": "Point",
    "coordinates": [0, 0]
  }
}
```

## Implicitly supported types {#implicit}

All `Implicit` types in the [above table](#types-table) are implicitly supported by the GraphQL Engine. You have to
provide the value as a **String**.

E.g. For time without time zone type

In ISO 8601 format

```graphql
objects: [
  {
    time_col: "04:05:06.789"
  }
]
```

E.g. For macaddr type

```graphql
objects: [
  {
    macaddr_col: "08:00:2b:01:02:03"
  }
]
```

Typically, implicit types only support reading and writing, but not more complex operations such as boolean comparisons
(except for equality) or aggregations.

:::info Note

You can learn more about PostgreSQL data types [here](https://www.postgresql.org/docs/current/static/datatype.html).

:::
